
#ifndef _SYS_H
#define _SYS_H

#include "stm32l1xx_hal.h"



typedef enum IOx_t
{
	IOA = GPIOA_BASE,
	IOB = GPIOB_BASE,
	IOC = GPIOC_BASE,
	IOD = GPIOD_BASE,
	IOE = GPIOE_BASE,
	IOH = GPIOH_BASE
} IOx_t;

typedef enum IOMode_t
{
	IO_IN = (uint32_t)0x00000000U,//????
	IO_OUT = (uint32_t)0x00000001U,//????
} IOMode_t;

typedef enum IOState_t
{
	IO_RESET = 0,
	IO_SET = 1
} IOState_t;

#define PIN0                 ((uint16_t)0x0001U)  /* Pin 0 selected    */
#define PIN1                 ((uint16_t)0x0002U)  /* Pin 1 selected    */
#define PIN2                 ((uint16_t)0x0004U)  /* Pin 2 selected    */
#define PIN3                 ((uint16_t)0x0008U)  /* Pin 3 selected    */
#define PIN4                 ((uint16_t)0x0010U)  /* Pin 4 selected    */
#define PIN5                 ((uint16_t)0x0020U)  /* Pin 5 selected    */
#define PIN6                 ((uint16_t)0x0040U)  /* Pin 6 selected    */
#define PIN7                 ((uint16_t)0x0080U)  /* Pin 7 selected    */
#define PIN8                 ((uint16_t)0x0100U)  /* Pin 8 selected    */
#define PIN9                 ((uint16_t)0x0200U)  /* Pin 9 selected    */
#define PIN10                ((uint16_t)0x0400U)  /* Pin 10 selected   */
#define PIN11                ((uint16_t)0x0800U)  /* Pin 11 selected   */
#define PIN12                ((uint16_t)0x1000U)  /* Pin 12 selected   */
#define PIN13                ((uint16_t)0x2000U)  /* Pin 13 selected   */
#define PIN14                ((uint16_t)0x4000U)  /* Pin 14 selected   */
#define PIN15                ((uint16_t)0x8000U)  /* Pin 15 selected   */
#define PINAll               ((uint16_t)0xFFFFU)  /* All pins selected */



IOState_t GET_IO(IOx_t iox,uint16_t Pinx);

void SET_IO(IOx_t iox,uint16_t Pinx,IOState_t state);
void INIT_IO(IOx_t IOx,uint16_t Pinx,IOMode_t mode);
void delay_ms(uint16_t time);




#endif

